Access denied, Please sign in and make sure you have proper permission.

Ruby IMGkit 根据 html 生成的图片为什么是一片空白的

2604249649 · August 14, 2023 · Last by 2604249649 replied at August 14, 2023 · 302 hits

想试一下IMGkit生成图片的效果,简单的试了一下,但是不知道为什么生成的图片是一片空白,除了表格还在,里面的文字信息都没了

#生成image,保存到本地
image_html_path = '/Users/unistart/Documents/stock_suggest/generate-image2.html'
image_html = File.read(image_html_path)

image = IMGKit.new(image_html, quality: 80, format: :jpg, height: 1024)
image.stylesheets << '/Users/unistart/Documents/stock_suggest/image.css'
image_path = "/Users/unistart/Pictures/image_#{Time.now.strftime('%F-%T')}.jpg"
image.to_file(image_path)

我是有哪里用的不对么,没明白为什么 html 表格中的文字信息,输出为图片时就都没了

应该是系统没有安装中文字体

Reply to Rei

我本机系统应该是有中文字体的

You need to Sign in before reply, if you don't have an account, please Sign up first.